<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
     // 类型转Number
     console.log(Number(''));  //0
        console.log(Number(null)); //0
        console.log(Number(0));   //0
        console.log(Number(1));   //1
        console.log(Number(true));  //1
        console.log(Number(false)); //0
        console.log(Number(undefined)); //NaN
        console.log(Number('str'));  //NaN
        console.log(Number(NaN));  //NaN
        console.log(Number(0 / 0));  //NaN
        console.log(Number(1 / 0));  //任何数字/0为infinity

        console.log('--------华丽的分割线--------')
        
        // isNaN 是会先判断是否为数字型,不是会转换成字符型在判断是否为  NaN
        console.log(isNaN(''));  //false
        console.log(isNaN(null)); //false
        console.log(isNaN(0));   //false
        console.log(isNaN(1));   //false
        console.log(isNaN(true));  //false
        console.log(isNaN(false)); //false
        console.log(isNaN(undefined)); //NaN
        console.log(isNaN('str'));  //NaN
        console.log(isNaN(NaN));  //NaN
        console.log(isNaN(0 / 0));  //NaN
        console.log(isNaN(1 / 0)); //false

        console.log('--------华丽的分割线--------')
        
        //Number.isNaN与isNaN最的区别是，Number.isNaN不存在类型转换的行为。

        console.log(Number.isNaN(''));  //false
        console.log(Number.isNaN(null)); //false
        console.log(Number.isNaN(0));   //false
        console.log(Number.isNaN(1));   //false
        console.log(Number.isNaN(true));  //false
        console.log(Number.isNaN(false)); //false
        console.log(Number.isNaN(undefined)); //f
        console.log(Number.isNaN('str'));  //f
        console.log(Number.isNaN(NaN));  //NaN
        console.log(Number.isNaN(0 / 0));  //NaN
        console.log(Number.isNaN(1 / 0)); //false
  </script>
</body>
</html>